//package com.itheima.health.utils;
//import org.springframework.stereotype.Component;
//import org.springframework.web.multipart.MultipartFile;
//
//import java.io.IOException;
//import java.io.InputStream;
//import java.util.UUID;
//
//@Component
//public class AliOSSUtils {
//    private AliOSSProperties properties;
//
//    public AliOSSUtils(AliOSSProperties properties) {
//        this.properties = properties;
//    }
//
//    public String upload(MultipartFile file) throws IOException {
//        InputStream inputStream = file.getInputStream();
//        String originalFilename = file.getOriginalFilename();
//        String var10000 = UUID.randomUUID().toString();
//        String fileName = var10000 + originalFilename.substring(originalFilename.lastIndexOf("."));
//        OSS ossClient = (new OSSClientBuilder()).build(this.properties.getEndpoint(), this.properties.getAccessKeyId(), this.properties.getAccessKeySecret());
//        ossClient.putObject(this.properties.getBucketName(), fileName, inputStream);
//        var10000 = this.properties.getEndpoint().split("//")[0];
//        String url = var10000 + "//" + this.properties.getBucketName() + "." + this.properties.getEndpoint().split("//")[1] + "/" + fileName;
//        ossClient.shutdown();
//        return url;
//    }
//}
